package edu.kit.aifb.ldstream.stat.distrib;

import java.io.Serializable;

public class PoissonDistribution implements IDistribution, Serializable {


	private static final long serialVersionUID = -7181740367479169424L;

	private double lambda;
	
	public PoissonDistribution(double lambda){
		this.lambda = lambda;
	}
	
	public double getLambda(){
		return this.lambda;
	}
	
	@Override
	public int getDistributionType() {
		return IDistribution.POISSON;
	}
	
	public String toString(){
		StringBuilder sb = new StringBuilder(" PoissonDistribution with ");
		sb.append(" lambda: ");
		sb.append(this.lambda);
		return sb.toString();
	}

	public boolean equals(Object o){
		if(o instanceof PoissonDistribution){
			PoissonDistribution pd = (PoissonDistribution) o;
			return Math.abs(this.lambda - pd.lambda) < 0.01d;
		}
		return false;
	}
	
	public int hashCode(){
		return (int) (10000 * this.lambda);
	}
	
}
